package com.lime49.lockcrypt.ui;

import com.jgoodies.looks.plastic.PlasticLookAndFeel;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

/**
 * Makes an item appear selected when the mouse hovers over it
 */
class MouseMenuListener extends MouseAdapter {
    @Override
    public void mouseEntered(MouseEvent e) {
        ((MouseMenuItem)e.getSource()).setForeground(PlasticLookAndFeel.getMenuItemSelectedForeground());
        ((MouseMenuItem)e.getSource()).setBackground(PlasticLookAndFeel.getMenuItemSelectedBackground());
        /*((JMouseMenuItem)e.getSource()).setForeground(UIManager.getColor("JMenuItem.selectionForeground"));
        ((JMouseMenuItem)e.getSource()).setBackground(UIManager.getColor("JMenuItem.selectionBackground")); */
    }
    @Override
    public void mouseExited(MouseEvent e) {
        ((MouseMenuItem)e.getSource()).setForeground(PlasticLookAndFeel.getControlTextColor());
        ((MouseMenuItem)e.getSource()).setBackground(PlasticLookAndFeel.getMenuItemBackground());
        /* ((JMouseMenuItem)e.getSource()).setForeground(UIManager.getColor("JMenuItem.Foreground"));
        ((JMouseMenuItem)e.getSource()).setBackground(UIManager.getColor("JMenuItem.Background")); */
    }
}
